﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="frmTipoIngredienteAlta.aspx.cs" Inherits="frmTipoIngrediente" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <style type="text/css">
        .style4
        {
            width: 183px;
            height: 65px;
        }
        .style6
        {
            height: 111px;
        }
        .style13
        {
            width: 183px;
            height: 44px;
        }
        .style19
        {
            width: 695px;
        }
        .style21
        {
            width: 183px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <h1>&nbsp;Nuevo Ingrediente</h1>
    <p>
        <asp:Label ID="Label1" runat="server" Font-Bold="True" ForeColor="#0033CC"></asp:Label>
    </p>
    <p>
        <table class="style19">
            <tr>
                <td class="style6" colspan="3">
                    Descripcion<br />
                    <asp:TextBox ID="TextBox1" runat="server" Height="74px" TextMode="MultiLine" 
                        Width="412px" MaxLength="20" Rows="1" 
                        ToolTip="Ingrese aqui una breve descripcion del ingrediente"></asp:TextBox>
                    <br />
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator9" runat="server" 
                        ControlToValidate="TextBox1" ErrorMessage="Ingrese una descripcion" 
                        Font-Bold="True" ForeColor="Red"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td class="style4">
                    Composicion Quimica<br />
                    <asp:TextBox ID="TextBox2" runat="server" Width="156px" Height="25px"></asp:TextBox>
                    <br />
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                        ControlToValidate="TextBox2" ErrorMessage="Debe ingresar un dato" 
                        Font-Bold="True" ForeColor="Red"></asp:RequiredFieldValidator>
                </td>
                <td class="style4">
                    Presentacion<br />
                    <asp:TextBox ID="TextBox4" runat="server" Width="156px" Height="25px"></asp:TextBox>
                    <br />
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" 
                        ControlToValidate="TextBox4" ErrorMessage="Debe ingresar un dato" 
                        Font-Bold="True" ForeColor="#FF3300"></asp:RequiredFieldValidator>
                </td>
                <td class="style4">
                    Denominación Legal<br />
                    <asp:TextBox ID="TextBox8" runat="server" Width="155px" Height="25px"></asp:TextBox>
                    <br />
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" 
                        ControlToValidate="TextBox8" ErrorMessage="Debe ingresar un dato" 
                        Font-Bold="True" ForeColor="Red"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td class="style21">
                    Aspecto<br />
                    <asp:TextBox ID="TextBox3" runat="server" Width="155px" Height="25px"></asp:TextBox>
                    <br />
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" 
                        ControlToValidate="TextBox3" ErrorMessage="Debe ingresar un dato" 
                        Font-Bold="True" ForeColor="#FF3300"></asp:RequiredFieldValidator>
                </td>
                <td class="style21" valign="top">
                    Calidad<br />
                    <asp:DropDownList ID="DropDownList4" runat="server" 
                        DataSourceID="SqlDataSource6" DataTextField="descripcion" 
                        DataValueField="idCalidad" Height="29px" Width="155px">
                    </asp:DropDownList>
                    <asp:SqlDataSource ID="SqlDataSource6" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
                        SelectCommand="SELECT * FROM [T_Calidad]"></asp:SqlDataSource>
                    <br />
                </td>
                <td class="style21" valign="top">
                    Zona de Comercialización<br />
                    <asp:DropDownList ID="DropDownList2" runat="server" 
                        DataSourceID="SqlDataSource3" DataTextField="descripcion" 
                        DataValueField="idZona" Height="29px" 
                        onselectedindexchanged="DropDownList2_SelectedIndexChanged" Width="155px">
                    </asp:DropDownList>
                    <br />
                </td>
            </tr>
            <tr>
                <td class="style13" valign="top">
                    Estado de Conservación<br />
                    <asp:DropDownList ID="DropDownList3" runat="server" 
                        DataSourceID="SqlDataSource5" DataTextField="descripcion" 
                        DataValueField="idEstado" Height="25px" Width="157px">
                    </asp:DropDownList>
                    <asp:SqlDataSource ID="SqlDataSource5" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
                        SelectCommand="SELECT * FROM [T_EstadoConservacion]"></asp:SqlDataSource>
                    <asp:SqlDataSource ID="SqlDataSource4" runat="server"></asp:SqlDataSource>
                    <br />
                </td>
                <td class="style13" valign="top">
                    Numero INS/Funcion<br />
                    <asp:TextBox ID="TextBox10" runat="server" Height="25px" Width="155px"></asp:TextBox>
                    <br />
                </td>
                <td class="style13" valign="top">
                    Tipo<br />
                    <asp:DropDownList ID="DropDownList1" runat="server" 
                        DataSourceID="SqlDataSource2" DataTextField="descripcion" 
                        DataValueField="codAditivo" Height="28px" Width="155px">
                    </asp:DropDownList>
                    <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:BD_SAFA_FINALConnectionString %>" 
                        SelectCommand="SELECT * FROM [T_TipoAditivo]"></asp:SqlDataSource>
                </td>
            </tr>
            <tr>
                <td class="style21">
                    Caracteres Organolépticos<br />
                    <asp:TextBox ID="TextBox7" runat="server" Height="68px" TextMode="MultiLine" 
                        Width="180px"></asp:TextBox>
                    <br />
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator10" runat="server" 
                        ControlToValidate="TextBox7" ErrorMessage="Complete este campo" 
                        Font-Bold="True" ForeColor="Red"></asp:RequiredFieldValidator>
                </td>
                <td class="style21">
                    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
                        DeleteCommand="DELETE FROM [T_TipoIngrediente] WHERE [idComponente] = @idComponente" 
                        InsertCommand="INSERT INTO [T_TipoIngrediente] ([descripcion], [composicionQuimica], [aspecto], [presentacion], [calidad], [estadoConservacion], [caracteresOrganolepticos], [denominacionLegal], [zonaComercializacion], [nroIns], [tipoDeIngrediente],[habilitado]) VALUES (@descripcion, @composicionQuimica, @aspecto, @presentacion, @calidad, @estadoConservacion, @caracteresOrganolepticos, @denominacionLegal, @zonaComercializacion, @nroIns, @tipoDeIngrediente,'1')" 
                        SelectCommand="SELECT [idComponente], [descripcion], [composicionQuimica], [aspecto], [presentacion], [calidad], [estadoConservacion], [caracteresOrganolepticos], [denominacionLegal], [zonaComercializacion], [nroIns], [tipoDeIngrediente] FROM [T_TipoIngrediente]" 
                        
                        
                        UpdateCommand="UPDATE [T_TipoIngrediente] SET [descripcion] = @descripcion, [composicionQuimica] = @composicionQuimica, [aspecto] = @aspecto, [presentacion] = @presentacion, [calidad] = @calidad, [estadoConservacion] = @estadoConservacion, [caracteresOrganolepticos] = @caracteresOrganolepticos, [denominacionLegal] = @denominacionLegal, [zonaComercializacion] = @zonaComercializacion, [nroIns] = @nroIns, [tipoDeIngrediente] = @tipoDeIngrediente WHERE [idComponente] = @idComponente">
                        <DeleteParameters>
                            <asp:Parameter Name="idComponente" Type="Int32" />
                        </DeleteParameters>
                        <InsertParameters>
                            <asp:Parameter Name="descripcion" Type="String" />
                            <asp:Parameter Name="composicionQuimica" Type="String" />
                            <asp:Parameter Name="aspecto" Type="String" />
                            <asp:Parameter Name="presentacion" Type="String" />
                            <asp:Parameter Name="calidad" Type="String" />
                            <asp:Parameter Name="estadoConservacion" Type="String" />
                            <asp:Parameter Name="caracteresOrganolepticos" Type="String" />
                            <asp:Parameter Name="denominacionLegal" Type="String" />
                            <asp:Parameter Name="zonaComercializacion" Type="String" />
                            <asp:Parameter Name="nroIns" Type="String" />
                            <asp:Parameter Name="tipoDeIngrediente" Type="String" />
                        </InsertParameters>
                        <UpdateParameters>
                            <asp:Parameter Name="descripcion" Type="String" />
                            <asp:Parameter Name="composicionQuimica" Type="String" />
                            <asp:Parameter Name="aspecto" Type="String" />
                            <asp:Parameter Name="presentacion" Type="String" />
                            <asp:Parameter Name="calidad" Type="String" />
                            <asp:Parameter Name="estadoConservacion" Type="String" />
                            <asp:Parameter Name="caracteresOrganolepticos" Type="String" />
                            <asp:Parameter Name="denominacionLegal" Type="String" />
                            <asp:Parameter Name="zonaComercializacion" Type="String" />
                            <asp:Parameter Name="nroIns" Type="String" />
                            <asp:Parameter Name="tipoDeIngrediente" Type="String" />
                            <asp:Parameter Name="idComponente" Type="Int32" />
                        </UpdateParameters>
                    </asp:SqlDataSource>
                </td>
                <td class="style21">
                    <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
                        SelectCommand="SELECT * FROM [T_Zonas]"></asp:SqlDataSource>
                </td>
            </tr>
            <tr>
                <td class="style21" valign="top">
                    <br />
                    <asp:Button ID="Button1" runat="server" Height="33px" onclick="Button1_Click" 
                        Text="Registrar Ingrediente" Width="175px" />
                    <br />
                </td>
                <td class="style21" valign="top">
                    <br />
                    <asp:Button ID="Button2" runat="server" CausesValidation="False" Height="33px" 
                        onclick="Button2_Click" Text="Regresar" Width="176px" />
                </td>
                <td class="style21" valign="middle">
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style21">
                    &nbsp;</td>
                <td class="style21">
                    &nbsp;</td>
                <td class="style21">
                    &nbsp;</td>
            </tr>
        </table>
    </p>
</asp:Content>

